package cn.com.ccxe.dao.parser;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import cn.com.ccxe.core.entity.MonitorType;

public class MonitorTypeParser implements ResultSetParser<MonitorType> {

	/**
	 * 将ResultSet中的{@link MonitorType}解析出来，并将结果添加到List容器中。
	 * {@inheritDoc}
	 * @param rs
	 * @return
	 * @throws SQLException
	 */
	public List<MonitorType> parse(ResultSet rs) throws SQLException {
		List<MonitorType> monitorList = new ArrayList<MonitorType>();
		while (rs.next()) {
			monitorList.add(parseObject(rs));
		}
		return monitorList;
	}
	
	/**
	 * {@inheritDoc}
	 */
	public MonitorType parseObject(ResultSet rs) throws SQLException {
		MonitorType monitor = new MonitorType();
		monitor.setId(rs.getInt("monitorId"));
		monitor.setType(rs.getString("monitorType"));
		monitor.setIsStart(rs.getInt("isStart"));
		return monitor;
	}
	
}